<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Setup</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqlnd-memcache.quickstart.html">Quickstart and Examples</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-memcache.quickstart.usage.html">Usage</a></div>
 <div class="up"><a href="mysqlnd-memcache.quickstart.html">Quickstart and Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="mysqlnd-memcache.quickstart.configuration" class="section">
  <h2 class="title">Setup</h2>
  <p class="para">
   The plugin is implemented as a PHP extension. See also the
   <a href="mysqlnd-memcache.installation.html" class="link">installation instructions</a> to
   install this extension.
  </p>
  <p class="para">
   Compile or configure the PHP MySQL extension (API) (<a href="ref.mysqli.html" class="link">mysqli</a>,
   <a href="ref.pdo-mysql.html" class="link">PDO_MYSQL</a>, <a href="ref.mysql.html" class="link">mysql</a>). 
   That extension must use the <a href="book.mysqlnd.html" class="link">mysqlnd</a> library as
   because mysqlnd_memcache is a plugin for the mysqlnd library.  For additional information,
   refer to the <a href="memcached.installation.html" class="link">mysqlnd_memcache installation instructions</a>.
  </p>
  <p class="para">
   Then, load this extension into PHP and activate the plugin in the PHP configuration
   file using the PHP configuration directive named
   <a href="mysqlnd-memcache.configuration.html#ini.mysqlnd-memcache.enable" class="link">mysqlnd_memcache.enable</a>.
  </p>
  <p class="para">
   <div class="example" id="example-1902">
    <p><strong>Example #1 Enabling the plugin (php.ini)</strong></p>
    <div class="example-contents">
<div class="inicode"><pre class="inicode">; On Windows the filename is php_mysqnd_memcache.dll
; Load the extension
extension=mysqlnd_memcache.so
; Enable it
mysqlnd_memcache.enable=1</pre>
</div>
    </div>

    </div>
  </p>
  <p class="para">
   Follow the instructions given in the <a href="http://dev.mysql.com/doc/en/ha-memcached.html" class="link external">&raquo;&nbsp;MySQL
   Reference Manual on installing the Memcache plugins</a> for the MySQL server. Activate
   the plugins and configure Memcache access for SQL tables.
  </p>
  <p class="para">
   The examples in this quickguide assume that the following table exists, and that
   Memcache is configured with access to it.
  </p>
  <p class="para">
   <div class="example" id="example-1903">
    <p><strong>Example #2 SQL table used for the Quickstart</strong></p>
    <div class="example-contents">
<div class="sqlcode"><pre class="sqlcode">CREATE TABLE test(
  id CHAR(16),
  f1 VARCHAR(255),
  f2 VARCHAR(255),
  f3 VARCHAR(255),
  flags INT NOT NULL,
  cas_column INT,
  expire_time_column INT,
  PRIMARY KEY(id)
  ) ENGINE=InnoDB;

INSERT INTO test (id, f1, f2, f3) VALUES (1, &#039;Hello&#039;, &#039;World&#039;, &#039;!&#039;);
INSERT INTO test (id, f1, f2, f3) VALUES (2, &#039;Lady&#039;, &#039;and&#039;, &#039;the tramp&#039;);

INSERT INTO innodb_memcache.containers(
  name, db_schema, db_table, key_columns, value_columns, 
  flags, cas_column, expire_time_column, unique_idx_name_on_key)
VALUES (
  &#039;plugin_test&#039;, &#039;test&#039;, &#039;test&#039;, &#039;id&#039;, &#039;f1,f2,f3&#039;,
  &#039;flags&#039;, &#039;cas_column&#039;, &#039;expire_time_column&#039;, &#039;PRIMARY KEY&#039;);</pre>
</div>
    </div>

   </div>
  </p>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="mysqlnd-memcache.quickstart.html">Quickstart and Examples</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="mysqlnd-memcache.quickstart.usage.html">Usage</a></div>
 <div class="up"><a href="mysqlnd-memcache.quickstart.html">Quickstart and Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
